﻿using System;
using System.Collections.Generic;
using NetTopologySuite.Noding;

namespace NetTopologySuite.GeometriesGraph
{
	public class EdgeNodingValidator
	{
		public static void CheckValid(IEnumerable<Edge> edges)
		{
			new EdgeNodingValidator(edges).CheckValid();
		}

		public static IEnumerable<ISegmentString> ToSegmentStrings(IEnumerable<Edge> edges)
		{
			IList<ISegmentString> list = new List<ISegmentString>();
			foreach (Edge edge in edges)
			{
				list.Add(new BasicSegmentString(edge.Coordinates, edge));
			}
			return list;
		}

		public EdgeNodingValidator(IEnumerable<Edge> edges)
		{
			this._nv = new FastNodingValidator(EdgeNodingValidator.ToSegmentStrings(edges));
		}

		public void CheckValid()
		{
			this._nv.CheckValid();
		}

		private readonly FastNodingValidator _nv;
	}
}
